Kzb binaries contain contents of your Kanzi Studio projects. To run your Kanzi application on a device, you need to export it as a .kzb binary.
When user starts a Kanzi application, Kanzi loads the content of one or more .kzb binaries. Kanzi loads the content to RAM and GPU memory when it needs to render it. See Resource management.
You can configure your Kanzi application:
onConfigure()
function.See Reference for application configuration.
To create a .kzb binary from a Kanzi Studio project, open your Kanzi Studio project and select > Export KZB > Export KZB Binary.
Kanzi Studio creates these files:
configuration.binaryName = "<ProjectName>.kzb.cfg"
If you export the .kzb binary of a Kanzi Studio project without C++ application, Kanzi Studio creates these files in <KanziWorkspace>/Projects/<ProjectName>/Binary, otherwise it creates these files in <KanziWorkspace>/Projects/<ProjectName>/Application/bin.
You can create a Kanzi application that loads its content from more than one .kzb binary. This way you can combine multiple Kanzi Studio projects into one Kanzi application when a user starts your Kanzi application.
When you want to use the same scene graph for your Kanzi application, use the same project name for all the projects you want to combine into one Kanzi application. When combining projects with the same name, each project item in the same location of the scene graph and the same name as a project item in another .kzb file is overwritten by the item from the .kzb file that is listed last in the .kzb.cfg file. For example, if you have two .kzb files named ProjectOne and each contains an object named Screen in the same location in the scene graph, Kanzi uses the Screen object contained by the project listed last in the .kzb.cfg. You can achieve a similar result by merging several Kanzi Studio projects in Kanzi Studio. See Merging projects.
When you want to use different scene graphs for your Kanzi application, use different project names for each project you want to combine into a single Kanzi application. You can combine projects with different names only using the Kanzi API.
To create and application from .kzb binaries from several Kanzi Studio projects with different names:
Loading_screen.kzb Project_one.kzb Project_two.kzb
// During development use the general kanzi.hpp header that covers // the majority of cases. For production use only the headers that // are used by your binaries. #include <kanzi/kanzi.hpp>
onProjectLoaded()
virtual function to load the content from the additional binaries. Kanzi calls the onProjectLoaded()
function after loading all kzb binaries.virtual void onProjectLoaded() KZ_OVERRIDE { ResourceManager* resourceManager = getDomain()->getResourceManager(); // First binary // Load the Viewport 2D prefab template named Viewport 2D from the first // binary using the kzb URL. PrefabTemplateSharedPtr viewportPrefabOne = resourceManager->acquireResource<PrefabTemplate>("kzb://Project one/Prefabs/Viewport 2D"); // Instantiate the loaded prefab and name the instance Viewport one. Viewport2DSharedPtr viewportOne = viewportPrefabOne->instantiate<Viewport2D>("Viewport one"); // Add the instantiated prefab as a child of the root of the scene graph // in the master project. getRoot()->addChild(viewportOne); // Second binary // Load the Viewport 2D prefab template named Viewport 2D from the second // binary using the kzb URL. PrefabTemplateSharedPtr viewportPrefabTwo = resourceManager->acquireResource<PrefabTemplate>("kzb://Project two/Prefabs/Viewport 2D"); // Instantiate the loaded prefab and name the instance Viewport two. Viewport2DSharedPtr viewportTwo = viewportPrefabTwo->instantiate<Viewport2D>("Viewport two"); // Add the instantiated prefab as a child of the root of the scene graph // in the master project. getRoot()->addChild(viewportTwo); }
Loading images from the file system